// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 信息 —————————————————————————————— //

  async remoteInfo({ state: { LOOP_PERIOD } }) {
    const num = (CORE.TIME.second / LOOP_PERIOD | 0) % 5 + 1
    const arr1 = Array(num).fill()
    const getNum = () => Math.random() * 100 | 0 + 1
    const getNum2 = (i) => 100 - (Math.random() * 20 | 0) - i * (80 / num | 0)

    const xData = arr1.map((_, i) => String.fromCharCode(i + 65))
    const dataList = arr1.map(getNum)
    const dataListMulti = arr1.fill().map((_, i) => arr1.map(() => getNum2(i)))
    const nameList = arr1.fill().map((_, i) => CORE.numWeek(i + 1))

    return {
      chart: {
        xData,
        dataList,
      },
      chartMulti: {
        xData,
        dataListMulti,
        nameList,
      },
    }
  },
}
